<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('债权交易列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>债权人：</label>
                                <input type="text" name="creditorName"/>
                            </li>
                            <li>
                                <label>债务人：</label>
                                <input type="text" name="debtorName"/>
                            </li>
                            <li>
                                <label>编码：</label>
                                <input type="text" name="bondCode"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="business:transaction:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" shiro:hasPermission="business:transaction:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:transaction:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:transaction:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var listFlag = [[${@permission.hasPermi('business:transaction:list')}]];

        var editFlag = [[${@permission.hasPermi('business:transaction:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:transaction:remove')}]];
        var creditorRightsStatusDatas = [[${@dict.getType('creditor_right_status')}]];
        var guaranteeStatusDatas = [[${@dict.getType('business_presence_or_absence')}]];
        var evidenceStatusDatas = [[${@dict.getType('business_whether')}]];
        var approvalStatusDatas = [[${@dict.getType('approval_status')}]];
        var payStatusDatas = [[${@dict.getType('pay_status')}]];
        var prefix = ctx + "business/transaction";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "债权交易",
                columns: [{
                    checkbox: true
                },
                    {
                    field: 'transactionId',
                    title: '交易id',
                    visible: false
                },
                    {
                    field: 'creditorName',
                    title: '主债权人名称'
                },
                {
                    field: 'contactNumber',
                    title: '主债权人联系电话'
                },
                    // {
                //     field: 'bond',
                //     title: '保证金'
                // },

                    {
                        field: 'civilJudgmentFont',
                        title: '民事判决书（或者仲裁书、调解书）字号'
                    },
                    {
                    field: 'compententCourt',
                    title: '执行法院'
                },
                    {
                        field: 'debtAmount',
                        title: '判决书标的额'
                    },
                    {
                        field: 'transferAmount',
                        title: '转让金额'
                    },
                    {
                    field: 'createTime',
                    title: '发布时间'
                },

                {
                    field: 'bondCode',
                    title: '管理编码'
                },
                // {
                //     field: 'approvalStatus',
                //     title: '审批状态',
                //     formatter: function(value, row, index) {
                //        return $.table.selectDictLabel(approvalStatusDatas, value);
                //     }
                // },
                // {
                //     field: 'rejectionReasons',
                //     title: '驳回原因',
                //     visible: false
                // },
                // {
                //     field: 'approvalTime',
                //     title: '审批时间'
                // },
                // {
                //     field: 'approver',
                //     title: '审批人',
                //     visible: false
                // },
                // {
                //     field: 'payStatus',
                //     title: '支付状态',
                //     formatter: function(value, row, index) {
                //        return $.table.selectDictLabel(payStatusDatas, value);
                //     },
                //     visible: false
                // },
                // {
                //     field: 'payAmount',
                //     title: '支付金额',
                //     visible: false
                // },
                // {
                //     field: 'payTime',
                //     title: '支付时间',
                //     visible: false
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="audit(\'' + row.transactionId + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        // actions.push('<a class="btn btn-success btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="pay(\'' + row.transactionId + '\')"><i class="fa fa-edit"></i>支付确认</a> ');

                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.transactionId + '\')"><i class="fa fa-edit"></i>修改</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="info(\'' + row.transactionId + '\')"><i class="fa fa-edit"></i>详情</a> ');

                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.transactionId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function audit(transactionId) {
            var url = prefix + '/audit/' + transactionId;
            $.modal.openFull("审批", url);
        }
        function info(transactionId) {
            var url = prefix + '/info/' + transactionId;
            $.modal.openTab("详情", url);
        }
        function pay(transactionId) {
            var url = prefix + '/pay/' + transactionId;
            $.modal.openFull("支付确认", url);
        }
    </script>
</body>
</html>